package com.bgs.travelapp.util;

import com.bgs.travelapp.ticket.mapper.TicketMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Configuration
@EnableScheduling
public class OptLogTask {

    @Autowired
    TicketMapper ticketMapper;

    @Scheduled(cron = "0 0 0 * * ?")
    public void deleteLOptLog(){
        Date date = new Date();
        Calendar c = Calendar.getInstance();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        c.setTime(date);
        c.add(Calendar.DAY_OF_MONTH,-30);
        Date time = c.getTime();
        String newDate = sdf.format(time);
    }

}
